package com.example.exceptionhandlerdemo.controller;

import com.example.exceptionhandlerdemo.common.ApiResponse;
import com.example.exceptionhandlerdemo.entity.User;
import org.springframework.core.MethodParameter;
import org.springframework.http.HttpStatus;
import org.springframework.http.MediaType;
import org.springframework.http.server.ServerHttpRequest;
import org.springframework.http.server.ServerHttpResponse;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;

@RestController
@RequestMapping("/user")
public class UserController {

    @RequestMapping("login")
    public String login(){
        Object obj = null;
        System.out.println(obj.hashCode());
        return  "这里是login";
    }

    @GetMapping("/data")
    public User getUserData() {
        // 这个方法会返回一个User对象
        User user = new User();
        user.setId(1);
        user.setName("张三");
        user.setEmail("zhangsan@example.com");
        return user;
    }

    @GetMapping("/success")
    public Integer getSuccessMessage() {
        // 这个方法会返回一个简单的字符串
        return 123456;
    }
}
